<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="StyleSheet" href="../../css/mypetstore.css" type="text/css" media="screen"/>
</head>
<body>
<div id="Content">
<div th:replace="jsp/common/top"></div>
<div id="BackLink">
    <!--  返回上一页的链接-->
          <a th:href="@{/catalog/viewCategory(categoryId=${product.getCategory()})}"
             th:text="'Return to'+ ${product.getCategory()}">
              Return to categoryPage
          </a>
</div>

<div id="Catalog">

    <h2 th:text="${product.name}"></h2>

    <table>
        <tr>
            <th>Item ID</th>
            <th>Product ID</th>
            <th>Description</th>
            <th>List Price</th>
            <th>&nbsp;</th>
        </tr>

            <tr th:each="item:${itemList}">

                <td>
                    <a th:href="@{/catalog/viewItem(itemId=${item.getItemid()})}"
                       th:text="${item.getItemid()}">
                        itemId
                    </a>
                </td>
                <td th:text="${item.getProductid()}">productId</td>
                <td>
                    <span th:if="${item.attr1 != null}" th:text="${item.attr1}"></span>
                    <span th:if="${item.attr2 != null}" th:text="${item.attr2}"></span>
                    <span th:if="${item.attr3 != null}" th:text="${item.attr3}"></span>
                    <span th:if="${item.attr4 != null}" th:text="${item.attr4}"></span>
                    <span th:if="${item.attr5 != null}" th:text="${item.attr5}"></span>
                    <span th:text="${product.getName()}"></span>
<!--                <span th:text="${item.attr1 != null ? item.attr1 : '替代文本1'}"></span>    -->
                </td>
<!--                <td>-->
<!--                    <fmt:formatNumber value="${item.listPrice}"-->
<!--                                      pattern="$#,##0.00"/>-->
<!--                </td> th:text="${#numbers.formatDecimal(item.getListprice(), 0, 'currency', '$')}"-->
                <td th:text="'$'+${item.getListprice()}">
                    listPrice
                </td>
                <td >

                    <a th:href="'/addItemToCart?' + 'workingItemId=' + ${item.itemid}">add to card</a>

                </td>
            </tr>

<!--        <c:forEach var="item" items="${sessionScope.itemList}">-->
<!--            <tr>-->
<!--                <td>-->
<!--                    <a href="itemForm?itemId=${item.itemId}">${item.itemId}</a>-->
<!--                </td>-->
<!--                <td>${item.product.productId}</td>-->
<!--                <td>${item.attribute1} ${item.attribute2} ${item.attribute3}-->
<!--                    ${item.attribute4} ${item.attribute5} ${sessionScope.product.name}-->
<!--                </td>-->
<!--                <td>-->
<!--                    <fmt:formatNumber value="${item.listPrice}"-->
<!--                                      pattern="$#,##0.00"/>-->
<!--                </td>-->
<!--                <td>-->
<!--                    <a href="addItemToCart?workingItemId=${item.itemId}" class="Button">Add to Cart</a>-->
<!--                </td>-->
<!--            </tr>-->
<!--        </c:forEach>-->
    </table>

</div>
<div th:replace="jsp/common/bottom"></div>
</div>
</body>
</html>